home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Cafe 3
/
Visual Cafe 3.ISO
/
Vcafe
/
Source.bin
/
WizardController.java
< prev
next >
Wrap
Text File
|
1998-08-21
|
9KB
|
314 lines
/*
* WizardController.java
*/
package symantec.itools.awt;
import java.awt.Component;
/**
* The WizardController interface provides a way to define a
* customized control of a Wizard.
* <p>
* The SimpleWizardController implements the basic default
* behavior for this interface.
*
* @see symantec.itools.awt.SimpleWizardController
*/
public interface WizardController
{
/**
* Constant wizard action value.
* @see #preparePage
* @see #validatePage
*/
public final static int PREVIOUS = 0;
/**
* Constant wizard action value.
* @see #preparePage
* @see #validatePage
*/
public final static int NEXT = 1;
/**
* Constant wizard action value.
* @see #preparePage
* @see #validatePage
*/
public final static int FINISH = 2;
/**
* Constant wizard action value.
* @see #preparePage
* @see #validatePage
*/
public final static int CANCEL = 3;
/**
* Constant wizard action value.
* @see #preparePage
* @see #validatePage
*/
public final static int HELP = 4;
// Life cycle
/**
* Called before the first page is shown.
* Default behavior: none.
*/
public abstract void doPrepare();
/**
* Called before a page is shown.
* Default behavior: add the page to the history stack if the action is
* NEXT, remove the last page from the history stack if the action is
* PREVIOUS.
*
* @param comp
* The page that will be shown.
* @param action
* The action that has led to this page, either PREVIOUS or NEXT. If it is
* the first page of the wizard, the action is NEXT.
* @see #getPreviousPage
*/
public abstract void preparePage(Component comp, int action);
/**
* Called after a page is shown.
* Default behavior: none.
*
* @param comp
* The page that has been shown.
*/
public abstract void pageShown(Component comp);
/**
* Try to validate a page.
* Default behavior: return the state of the button associated with
* the action, using the isXxxEnabled methods. For example, if the
* controller has the Previous button enabled, this method will return
* true, meaning that it is valid to go back.
* If the result is true, then the Wizard will proceed with the
* action, else the state will not change.
*
* @param comp
* The page that must be validated.
* @param target
* The page that will be shown if the action is PREVIOUS or NEXT, null
* otherwise.
* @param action
* The action that must be validated, PREVIOUS, NEXT, FINISH, CANCEL or HELP.
* @return
* True if the action is validated, false otherwise.
*/
public abstract boolean validatePage(Component comp, Component target, int action);
/**
* Called before the page is hidden.
* Default behavior: none.
*
* @param comp
* The page that has been shown.
*/
public abstract void pageHidden(Component comp);
/**
* Called when the FINISH action has been validated.
* Default behavior: none.
*/
public abstract void doFinish();
/**
* Called when the CANCEL action has been validated.
* Default behavior: none.
*/
public abstract void doCancel();
/**
* Called when the HELP action has been validated.
* Default behavior: none.
*/
public abstract void doHelp();
// State
/**
* Tells if the Previous button must be enabled.
* Default behavior: return true if the getPreviousPage method
* returns a page, false otherwise.
*
* @return
* True if the Previous button must be enabled, false otherwise.
*/
public abstract boolean isPreviousEnabled();
/**
* Tells if the Next button must be enabled.
* Default behavior: return true if the getNextPage method
* returns a page, false otherwise.
*
* @return
* True if the Next button must be enabled, false otherwise.
*/
public abstract boolean isNextEnabled();
/**
* Tells if the Finish button must be enabled.
* Default behavior: return true if the current page is the last page
* in the Wizard container.
*
* @return
* True if the Finish button must be enabled, false otherwise.
*/
public abstract boolean isFinishEnabled();
/**
* Tells if the Cancel button must be enabled.
* Default behavior: return true.
*
* @return
* True if the Cancel button must be enabled, false otherwise.
*/
public abstract boolean isCancelEnabled();
/**
* Tells if the Help button must be enabled.
* Default behavior: return false.
*
* @return
* True if the Help button must be enabled, false otherwise.
*/
public abstract boolean isHelpEnabled();
/**
* Return the previous page.
* Default behavior: if a previous page has been set with
* setPreviousPage, return this page. If a previous page index has
* been set with setPreviousPageIndex, return the associated page.
* Else, return the next to last element on the stack. If there is none,
* return null.
* This method is called before and after a validatePage, and by the
* default implementation of isPreviousEnabled.
*
* @return
* The previous page to show, null if there is none.
* @see #setPreviousPage
* @see #setPreviousPageIndex
* @see #preparePage
*/
public abstract Component getPreviousPage();
/**
* Return the next page.
* Default behavior: if a next page has been set with
* setNextPage, return this page. If a next page index has
* been set with setNextPageIndex, return the associated page.
* Else, return the next page in the Wizard components order,
* page 0 if no page has been shown.
* If there is none, return null.
* This method is called before and after a validatePage, and by the
* default implementation of isNextEnabled.
*
* @return
* The next page to show, null if there is none.
* @see #setNextPage
* @see #setNextPageIndex
*/
public abstract Component getNextPage();
// Interactions
/**
* Set an index for the previous page.
* This index is used by the default implementation of getPreviousPage.
* It is reset after a page has been shown.
*
* @see #getPreviousPage
* @see #resetChainInfo
*/
public abstract void setPreviousPageIndex(int index);
/**
* Set an index for the next page.
* This index is used by the default implementation of getNextPage.
* It is reset after a page has been shown.
*
* @see #getNextPage
* @see #resetChainInfo
*/
public abstract void setNextPageIndex(int index);
/**
* Set a previous page.
* This page is used by the default implementation of getPreviousPage.
* It is reset after a page has been shown.
*
* @see #getPreviousPage
* @see #resetChainInfo
*/
public abstract void setPreviousPage(Component comp);
/**
* Set a next page.
* This page is used by the default implementation of getNextPage.
* It is reset after a page has been shown.
*
* @see #getNextPage
* @see #resetChainInfo
*/
public abstract void setNextPage(Component comp);
/**
* Enables or disables the Previous button.
* @param status <code>true</code> to enable the button
*
* @see #setNextEnabled
* @see #setFinishEnabled
* @see #setCancelEnabled
* @see #setHelpEnabled
*/
public abstract void setPreviousEnabled(boolean status);
/**
* Enables or disables the Next button.
* @param status <code>true</code> to enable the button
*
* @see #setPreviousEnabled
* @see #setFinishEnabled
* @see #setCancelEnabled
* @see #setHelpEnabled
*/
public abstract void setNextEnabled(boolean status);
/**
* Enables or disables the Finish button.
* @param status <code>true</code> to enable the button
*
* @see #setPreviousEnabled
* @see #setNextEnabled
* @see #setCancelEnabled
* @see #setHelpEnabled
*/
public abstract void setFinishEnabled(boolean status);
/**
* Enables or disables the Cancel button.
* @param status <code>true</code> to enable the button
*
* @see #setPreviousEnabled
* @see #setNextEnabled
* @see #setFinishEnabled
* @see #setHelpEnabled
*/
public abstract void setCancelEnabled(boolean status);
/**
* Enables or disables the Help button.
* @param status <code>true</code> to enable the button
*
* @see #setPreviousEnabled
* @see #setNextEnabled
* @see #setFinishEnabled
* @see #setCancelEnabled
*/
public abstract void setHelpEnabled(boolean status);
/**
* Reset the chain information set by setPreviousPageIndex,
* setNextPageIndex, setPreviousPage and setNextPage.
*
* @see #setPreviousPageIndex
* @see #setNextPageIndex
* @see #setPreviousPage
* @see #setNextPage
*/
public abstract void resetChainInfo();
}